package jjoms.model.main;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import jjoms.model.info.InfoVO;
import jjoms.model.item.ItemVO;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class MainDAOImpl implements MainDAO {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<ItemVO> getItemList(String keyword) {
		return sqlSessionTemplate.selectList("main.getItemList", keyword);
	}

	public InfoVO sectionFindByKeyword(String keyword) {
		return sqlSessionTemplate.selectOne("main.sectionFindByKeyword",
				keyword);
	}

	@Override
	public InfoVO divisionFindByKeyword(String keyword) {
		return sqlSessionTemplate.selectOne("info.divisionFindByKeyword",
				keyword);
	}

	@Override
	public List<ItemVO> NewgetItemList(String keyword) {
		return sqlSessionTemplate.selectList("main.NewgetItemList", keyword);
	}

	@Override
	public List<String> getAllListKeyword(String keyword) {
		return sqlSessionTemplate.selectList("main.getAllListKeyword", keyword);
	}
	
	@Override
	public List<String> categoryAutoKeyword(String keyword, String kind) {
		HashMap map = new HashMap<>();
		map.put("keyword", keyword);
		map.put("kind", kind);
		return sqlSessionTemplate.selectList("main.categoryAutoKeyword", map);
	}

}
